#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;

const int MAXN = 1000010;
const int mod = 100003;

bool vis[MAXN];
int path[MAXN];
int ans[MAXN];

vector<int> v[MAXN];
queue<int> node;

int N, M;
int x, y;

void bfs()
{
    node.push(1);
    vis[1] = true;
    ans[1] = 1;
    while (!node.empty())
    {
        int u = node.front();
        node.pop();
        for (int i = 0; i < v[u].size(); i++)
        {
            int temp = v[u][i];
            if (!vis[temp])
            {
                path[temp] = path[u] + 1; //记录距离
                node.push(temp);
                vis[temp] = true;
            }
            if (path[temp] == path[u] + 1)
            { //如果已经访问过但是又可以到达
                ans[temp] += ans[u];
                ans[temp] %= mod;
            }
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> N >> M;
    for (int i = 1; i <= M; i++)
    {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x); //注意到是无向图
    }
    bfs();
    for (int i = 1; i <= N; i++)
    {
        cout << ans[i] << endl;
    }
    // system("pause");
    return 0;
}